package com.oi.eksekutif.domain;

import java.io.Serializable;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;

/**
 * Created by IntelliJ IDEA.
 * Author   : Deny Prasetyo, S.T
 * Email    : jasoet87@gmail.com
 * Blog     : jasoet.wordpress.com
 * Twitter  : http://www.twitter.com/jasoet
 */
@Entity
@Table
public class MerkMobil implements Serializable {

    @Id
    @GeneratedValue
    private Long id;
    @Column(length = 15)
    @NotNull
    private String pabrikan = "";
    @Column(length = 35)
    @NotNull
    private String seri = "";

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public String getPabrikan() {
        return pabrikan;
    }

    public void setPabrikan(String pabrikan) {
        this.pabrikan = pabrikan;
    }

    public String getSeri() {
        return seri;
    }

    public void setSeri(String seri) {
        this.seri = seri;
    }

    @Override
    public boolean equals(Object obj) {
        if (obj == null) {
            return false;
        }
        if (getClass() != obj.getClass()) {
            return false;
        }
        final MerkMobil other = (MerkMobil) obj;
        if (this.id != other.id && (this.id == null || !this.id.equals(other.id))) {
            return false;
        }
        if ((this.pabrikan == null) ? (other.pabrikan != null) : !this.pabrikan.equals(other.pabrikan)) {
            return false;
        }
        if ((this.seri == null) ? (other.seri != null) : !this.seri.equals(other.seri)) {
            return false;
        }
        return true;
    }

    @Override
    public int hashCode() {
        int hash = 7;
        hash = 97 * hash + (this.id != null ? this.id.hashCode() : 0);
        hash = 97 * hash + (this.pabrikan != null ? this.pabrikan.hashCode() : 0);
        hash = 97 * hash + (this.seri != null ? this.seri.hashCode() : 0);
        return hash;
    }

    @Override
    public String toString() {
        return this.getPabrikan() + " " + this.getSeri();
    }
}
